package eg.backend.base.repository;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

public interface EntityRepository<T, PK extends Serializable> {
	@Transactional
    T save(T entity);

	@Transactional
    void delete(T entity);
    
	@Transactional
    void delete(PK identifier);

	@Transactional
    void deleteAll(List<T> entities);

	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    T get(PK identifier);

	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
    List<T> loadAll();

	@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
	List<T> findByNamedQuery(String queryName, Map<String, Object> queryParams);
}
